<template>
  <div>
      
      娱乐:{{ this.$route.params.content }}
    <p v-if="blueData.chengpinDetails">{{ blueData.chengpinDetails[0].title }}</p>
    <p>hello</p>
        <p>hello</p>
        <p>hello</p>
    </div>
</template>
<script>
export default {
  name: "Enjoy",
  data() {
    return {
      blueData: {}
    };
  },
  beforeRouteEnter(to, from, next) {
    // console.log(from);
    // console.log(to);
    // next();
    // 不！能！获取组件实例 `this`

    // vm => vm.$axios
    //     .get("http://iwenwiki.com/sxtstu/blueberrypai/getChengpinDetails.php")
    //     .then(res => {
    //       console.log(res.data);
    //       next();
    //     })
    //     .catch(error => {
    //       console.log(error);
    //       next();
    //     });

    fetch("http://iwenwiki.com/sxtstu/blueberrypai/getChengpinDetails.php")
      .then(res => res.json())
      .then(data => {
        next(vm => vm.setData(data));
      });
  },
  beforeRouteUpdate(to, from, next) {
    next();
  },
  beforeRouteLeave(to, from, next) {
    next();
  },
  methods: {
    setData(data) {
      console.log(data);
      this.blueData = data;
    }
  }
};
</script>
<style scoped>
p{
    height: 500px;
}
</style>
